﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KL.Store.Core.Domain;
using TN.Data;

namespace KL.Store.Data
{
    public class dbAddressOrder
    {
        #region Insert

        public static void Insert(short OrderType, int OrderId, string AddressType, string Name, string TaxOffice, string TaxNo, string Address1, string Address2, string County, string PostalCode, short Country, short City, int CreateUser, string Phone)
        {
            SqlHelper.ExecuteNonQuery(dbParameters.dsnStore, "SPR_ESTORE_Address_Order_Insert", new object[] { OrderType, OrderId, AddressType, Convert2.ToString(Name), Convert2.ToString(TaxOffice), Convert2.ToString(TaxNo), Convert2.ToString(Address1), Convert2.ToString(Address2), Convert2.ToString(County), Convert2.ToString(PostalCode), Country, City, CreateUser, Convert2.ToString(Phone) });
        }

        #endregion

        #region Get

        public static AddressOrder Get(short OrderType, int OrderId, string AddressType)
        {
            IList<AddressOrder> objectList = new List<AddressOrder>();
            SqlHelper.FillList(dbParameters.dsnStore, "SPR_ESTORE_Address_Order_Get", objectList, new object[] {  OrderType,  OrderId,  AddressType });
            return objectList.FirstOrDefault();
        }

        #endregion
    }
}
